home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00145_X Bottle Popup.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  1.8 KB  |  75 lines

  1. property pSpr, pBottleSprite, pXliquorList, pXliquorMenu, pDefaultIngredient, pNewMouseLoc
  2. global gXliquorList
  3.  
  4. on beginSprite me
  5.   global gIngredients
  6.   pSpr = sprite(me.spriteNum)
  7.   mHidePopup(me)
  8.   pXliquorList = []
  9.   repeat with X = 1 to count(gIngredients)
  10.     if getXbottleness(gIngredients[X]) then
  11.       add(pXliquorList, getPropAt(gIngredients, X))
  12.     end if
  13.   end repeat
  14.   pXliquorList = duplicate(gXliquorList)
  15.   pXliquorMenu = "Default Liquor" & RETURN
  16.   repeat with thisBottle in pXliquorList
  17.     put getname(thisBottle) & RETURN after pXliquorMenu
  18.   end repeat
  19.   delete char -30000 of pXliquorMenu
  20.   addAt(pXliquorList, 1, #dummy)
  21.   customFont(pSpr.member)
  22. end
  23.  
  24. on mShowPopup me, origSprite, defaultIngredient, newMouseLoc
  25.   pDefaultIngredient = defaultIngredient
  26.   pXliquorList[1] = pDefaultIngredient
  27.   put getMediumName(pDefaultIngredient) into line 1 of pXliquorMenu
  28.   if voidp(newMouseLoc) then
  29.     pNewMouseLoc = the clickLoc
  30.   else
  31.     pNewMouseLoc = newMouseLoc
  32.   end if
  33.   pSpr.locH = min(pNewMouseLoc.locH, (the stage).rect.width - pSpr.member.width - 5)
  34.   pSpr.locV = min(pNewMouseLoc.locV, (the stage).rect.height - pSpr.member.height - 15)
  35.   pSpr.loc = pSpr.loc - 10
  36.   pSpr.member.text = pXliquorMenu
  37.   pBottleSprite = origSprite
  38. end
  39.  
  40. on mouseDown me
  41.   thisLine = the mouseLine
  42.   if thisLine > 0 then
  43.     newIngredient = pXliquorList[thisLine]
  44.     sendSprite(pBottleSprite, #mUseXbottle, newIngredient)
  45.     if not voidp(pNewMouseLoc) then
  46.       placeCursor(pNewMouseLoc)
  47.     end if
  48.   end if
  49.   mHidePopup(me)
  50. end
  51.  
  52. on rightMouseDown me
  53.   if the stage = the activeWindow then
  54.     mouseDown(me)
  55.   end if
  56. end
  57.  
  58. on mouseWithin me
  59.   thisLine = the mouseLine
  60.   if thisLine > 0 then
  61.     hilite line thisLine of field the member of pSpr
  62.   end if
  63. end
  64.  
  65. on mouseLeave me
  66.   mHidePopup(me)
  67. end
  68.  
  69. on mHidePopup me
  70.   pSpr.locH = 1000
  71. end
  72.  
  73. on endSprite
  74. end
  75.